package jndi.ldap.biz;

import jndi.ldap.domains.LdapUser;

import javax.naming.NamingException;
import javax.naming.directory.Attributes;

public class UserAttributesMapper implements AttributesMapper{

    public LdapUser mapFromAttributes(Attributes attrs) {
        LdapUser user = new LdapUser();
        try {
//            user.setUserPrincipalName((String) attrs.get("userPrincipalName").get());
//            user.setsAMAccountName((String) attrs.get("sAMAccountName").get());
            user.setDistinguishedName((String) attrs.get("distinguishedName").get());
//            user.setUserAccountControl(Integer.decode((String) attrs.get("").get()));
        } catch (NamingException e) {
            throw new RuntimeException(e);
        }
        return user;
    }

}
